package dao;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;

public abstract class ModelDAO<T> {
		
	public void guardar(T t) {
		Session session = SesionDAO.getSessionFactory();
		try {
			session.beginTransaction();
			session.save(t);
			session.getTransaction().commit();
		} catch (HibernateException ex) {
			ex.printStackTrace();
		}
	}
	
	public void actualizar(T t){
		Session session = SesionDAO.getSessionFactory();
		try {
			session.beginTransaction();
			session.update(t);
			session.getTransaction().commit();
		} catch (HibernateException ex) {
			ex.printStackTrace();
		}
	}
	
	public void eliminar(T t){
		Session session = SesionDAO.getSessionFactory();
		session.beginTransaction();
		session.delete(t);
		session.getTransaction().commit();
	}
	
	public List<T> getList(){
		
		
		return null; 
	}
	
}
